package mtgGameObjects.mtgGameTypes.mtgGameTypeMana;

import java.util.List;

import mtgGameObjects.MtgGameObjectsList;

public abstract class MtgGameManaList extends MtgGameObjectsList<MtgGameTypeMana> {

	@Override
	public void add(MtgGameTypeMana mMana){
		boolean hasBeenAdded = false;
		for (MtgGameTypeMana mCost:this.getMtgObjectList()){
			if (mCost.getClass()==mMana.getClass()){
				mCost.addQuantity(mMana.getQuantity());
				hasBeenAdded = true;
			}
		}
		if (!hasBeenAdded){
			this.getMtgObjectList().add(mMana);
		}
	}
	
	@Override
	public List<MtgGameTypeMana> getMtgObjectList() {
		return super.getMtgObjectList();
	}
	
	public String getNormalizedSymbol(){
		String symbol = "";
		for (MtgGameTypeMana mana:this.getMtgObjectList()){
			symbol += mana.getNormalizedSymbol();
		}
		return symbol;
	}

}
